/**
 * 上海中赢金融信息服务有限公司
 * Copyright (c) 2017-2027 Chinazyjr,Inc.All Rights Reserved.
 */

package com.sys.midware.zookeeper.sample.facade;

import java.util.Map.Entry;

import org.jboss.netty.util.internal.ConcurrentHashMap;

import com.sys.midware.zookeeper.curator.ZKRegistryCenter;

/**
 * <b>ClassName:</b> JobZookeeperFacade.java <br/>
 * <b>Description:</b> TODO <br/>
 * <b>Date:</b> 2016年6月1日 下午3:56:45<br/>
 * 
 * @author mobing
 * @version
 */
public class SampleZookeeperFacade {

    public static final String NAMESPACE_JOB = "job";

    public SampleZookeeperFacade() {
    }

    public static ConcurrentHashMap<String, ZKRegistryCenter> zkClientMap = new ConcurrentHashMap<String, ZKRegistryCenter>();

    public void start() {
        ZKRegistryCenter zk = new ZKRegistryCenter(NAMESPACE_JOB);
        zk.init();
        zkClientMap.putIfAbsent(NAMESPACE_JOB, zk);

    }

    
    public void close(){
        for(Entry<String,ZKRegistryCenter> map: zkClientMap.entrySet()){
            ZKRegistryCenter zk= map.getValue();
            zk.close();
        }
    }
}
